nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound

AI-powered interview preparation platform. Practice with curated questions, mock interviews, and personalized learning paths to crack your dream tech interview.

Quick Links

  • Technologies
  • Saved Questions
  • Pricing

Company

  • About Us
  • Contact Us

Legal

  • Privacy Policy
  • Terms of Use

© 2026 nextRound. All rights reserved.

TOPIC OVERVIEW

react/Lifecycle functions

The specific moments a component mounts, updates, and unmounts.

10 QuestionsAdvancedHigh Priority ~12 min read

Class components expose specific methods tied to three phases: mounting (constructor, render, componentDidMount), updating (render, componentDidUpdate), and unmounting (componentWillUnmount). Less common ones like getDerivedStateFromProps exist for narrow cases — syncing state from props in rare situations — and are intentionally awkward to use, since most 'derived state' problems are better solved by computing the value during render instead of storing it in state at all.

useEffect approximates these phases in function components, but the mapping isn't exact: an effect with an empty dependency array runs after mount, a cleanup function runs before unmount (and before every subsequent effect re-run), and effects with dependencies re-run on update. The subtlety interviewers actually probe for is timing — componentDidMount runs synchronously before the browser paints, while a plain useEffect runs after paint, which is why useLayoutEffect exists for the rare cases where that distinction actually matters.

What you'll walk away knowing

The three lifecycle phases (mounting, updating, unmounting) and which class methods belong to each
How useEffect maps onto these phases, and specifically where the mapping isn't exact
Why componentDidMount runs before paint while a plain useEffect runs after it, and when that timing matters
When getDerivedStateFromProps or componentDidCatch are still genuinely needed over a hooks-based approach
1Describe componentDidMount() method.Intermediate2Discuss getSnapshotBeforeUpdate.Advanced3Describe getDerivedStateFromProps.Intermediate4What is the role of the `shouldComponentUpdate` method?Intermediate5Explain the use of the componentDidCatch method.Intermediate6Describe render method.Intermediate7Describe the constructor method in class components.Intermediate8Name the different lifecycle methods along with phases in which they are called.Intermediate9List all lifecycle methods.Intermediate
All Topics
1
Basics
JSX
State and Props
Components
Function Components
2
Virtual DOM
Reconciliation
Class Components
Lifecycle functions
3
Hooks
useState
useReducer
useMemo
useContext
useCallback
useEffect
Custom Hooks
New Hooks
4
Code Sharing
HOC
Refs
Data Sharing
Events
Context API
5
Redux
Router
CSR-SSR
React APIs
ReactDOM
Strict Mode
6
Performance Optimisation
Security
Sharethis topic

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.